Skip to content

feat(sandbox): auto transpile public contract functions in sandbox#6140

Merged
dbanks12 merged 13 commits intomasterfrom
db/sandbox-auto-transpile
May 29, 2024
Merged

feat(sandbox): auto transpile public contract functions in sandbox#6140
dbanks12 merged 13 commits intomasterfrom
db/sandbox-auto-transpile

Conversation

@dbanks12
Copy link
Contributor

@dbanks12 dbanks12 commented May 1, 2024

No description provided.

Copy link
Contributor Author

dbanks12 commented May 1, 2024

@dbanks12 dbanks12 force-pushed the db/sandbox-auto-transpile branch 2 times, most recently from b394e51 to 12922ea Compare May 2, 2024 23:22
@dbanks12 dbanks12 requested a review from charlielye as a code owner May 2, 2024 23:22
Copy link
Contributor

@charlielye charlielye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TLDR I think best approach is (open to discussion):

  • Create new aztec-nargo at top level of repo.
  • Create Earthfile that creates image aztecprotocol/aztec-nargo that contains both noir bin and transpiler bin and wrapper script with wrapper as entrypoint.
  • Release that instead of current two containers.
  • Update the aztec-up wrapper script to run aztecprotocol/aztec-nargo instead of aztecprotocol/noir.
    *If this isn't being released immediately, save yourself having to do Dockerfile and old CI work. Liase with Phil about when we can do releases from Earthly GA.

@dbanks12 dbanks12 force-pushed the db/nargo-show-artifact-paths branch from 42480d9 to 93ed10e Compare May 21, 2024 16:16
@dbanks12 dbanks12 force-pushed the db/sandbox-auto-transpile branch 2 times, most recently from d8da6da to f6b6f33 Compare May 21, 2024 16:17
@AztecBot
Copy link
Collaborator

AztecBot commented May 21, 2024

Benchmark results

Metrics with a significant change:

  • protocol_circuit_witness_generation_time_in_ms (root-parity): 62.9 (-37%)
  • l2_block_processing_time_in_ms (32): 5,788 (+21%)
Detailed results

All benchmarks are run on txs on the Benchmarking contract on the repository. Each tx consists of a batch call to create_note and increment_balance, which guarantees that each tx has a private call, a nested private call, a public call, and a nested public call, as well as an emitted private note, an unencrypted log, and public storage read and write.

This benchmark source data is available in JSON format on S3 here.

Proof generation

Each column represents the number of threads used in proof generation.

Metric 1 threads 4 threads 16 threads 32 threads 64 threads
proof_construction_time_sha256_ms 5,780 (+1%) 1,558 (+1%) 700 749 (+2%) 764 (-1%)
proof_construction_time_sha256_30_ms 11,881 (+4%) 3,194 (+4%) 1,410 (+3%) 1,449 (+2%) 1,469 (+2%)
proof_construction_time_sha256_100_ms 44,292 (+1%) 11,894 (+1%) 5,859 (+8%) 5,370 (-11%) 5,362
proof_construction_time_poseidon_hash_ms 238 (+1%) 80.0 (+1%) 58.0 89.0 148
proof_construction_time_poseidon_hash_30_ms 5,817 (+1%) 1,597 (+2%) 728 (+2%) 798 (+4%) 801 (+1%)
proof_construction_time_poseidon_hash_100_ms 11,460 (+1%) 3,075 (+1%) 1,372 1,427 (+2%) 1,452 (+1%)

L2 block published to L1

Each column represents the number of txs on an L2 block published to L1.

Metric 8 txs 32 txs 64 txs
l1_rollup_calldata_size_in_bytes 1,412 1,412 1,412
l1_rollup_calldata_gas 9,452 9,440 9,464
l1_rollup_execution_gas 616,093 616,081 616,105
l2_block_processing_time_in_ms 1,292 (+1%) ⚠️ 5,788 (+21%) 9,530
l2_block_building_time_in_ms 45,766 187,513 (+3%) 371,866 (+2%)
l2_block_rollup_simulation_time_in_ms 45,592 186,880 (+3%) 370,600 (+2%)
l2_block_public_tx_process_time_in_ms 25,249 (+3%) 105,355 (+3%) 216,261 (+3%)

L2 chain processing

Each column represents the number of blocks on the L2 chain where each block has 16 txs.

Metric 3 blocks 5 blocks
node_history_sync_time_in_ms 9,408 14,337
node_database_size_in_bytes 14,512,208 21,319,760
pxe_database_size_in_bytes 18,071 29,868

Circuits stats

Stats on running time and I/O sizes collected for every kernel circuit run across all benchmarks.

Circuit simulation_time_in_ms witness_generation_time_in_ms proving_time_in_ms input_size_in_bytes output_size_in_bytes proof_size_in_bytes num_public_inputs size_in_gates
private-kernel-init 137 (+1%) 463 (-5%) 12,572 (-12%) 20,630 64,614 89,536 2,731 524,288
private-kernel-inner 407 928 (+1%) 42,479 (-9%) 92,318 64,614 89,536 2,731 2,097,152
private-kernel-tail 581 2,902 (+11%) 46,552 (+3%) 96,541 77,732 11,648 297 2,097,152
base-parity 6.41 1,123 (-1%) 2,818 (+1%) 128 64.0 2,208 2.00 131,072
root-parity 48.8 ⚠️ 62.9 (-37%) 49,939 (-2%) 27,084 64.0 2,720 18.0 2,097,152
base-rollup 710 (-3%) 2,389 (-1%) 87,344 (+3%) 119,734 756 3,648 47.0 4,194,304
root-rollup 109 74.3 (-6%) 22,237 (-3%) 25,297 620 3,456 41.0 1,048,576
public-kernel-app-logic 542 (+1%) 3,056 (-1%) 52,446 (+2%) 105,253 86,550 116,768 3,582 2,097,152
public-kernel-tail 1,134 (+2%) 23,523 (-1%) 179,235 (+1%) 401,002 7,646 11,648 297 8,388,608
private-kernel-reset-small 588 1,928 (-8%) 50,149 (+1%) 120,733 64,614 89,536 2,731 2,097,152
merge-rollup 28.6 N/A N/A 16,534 756 N/A N/A N/A
public-kernel-setup 635 (-2%) N/A N/A 105,253 86,550 N/A N/A N/A
public-kernel-teardown 546 N/A N/A 105,253 86,550 N/A N/A N/A
private-kernel-tail-to-public N/A 7,926 (-6%) 103,966 (-2%) N/A N/A 116,768 3,582 4,194,304

Stats on running time collected for app circuits

Function input_size_in_bytes output_size_in_bytes witness_generation_time_in_ms proof_size_in_bytes proving_time_in_ms size_in_gates num_public_inputs
ContractClassRegisterer:register 1,344 9,944 462 N/A N/A N/A N/A
ContractInstanceDeployer:deploy 1,408 9,944 41.0 (-1%) N/A N/A N/A N/A
MultiCallEntrypoint:entrypoint 1,920 9,944 1,676 (+1%) N/A N/A N/A N/A
SchnorrAccount:constructor 1,312 9,944 1,414 N/A N/A N/A N/A
SchnorrAccount:entrypoint 2,304 9,944 2,666 (+2%) 16,768 52,446 (-2%) 2,097,152 457
Token:privately_mint_private_note 1,280 9,944 1,660 (+8%) N/A N/A N/A N/A
Token:transfer 1,376 9,944 4,889 16,768 52,211 (-9%) 2,097,152 457
Benchmarking:create_note 1,344 9,944 1,444 (+3%) N/A N/A N/A N/A
FPC:fee_entrypoint_public 1,344 9,944 226 N/A N/A N/A N/A
SchnorrAccount:spend_private_authwit 1,280 9,944 77.0 N/A N/A N/A N/A
Token:unshield 1,376 9,944 3,690 N/A N/A N/A N/A
FPC:fee_entrypoint_private 1,376 9,944 4,548 (-1%) N/A N/A N/A N/A

Tree insertion stats

The duration to insert a fixed batch of leaves into each tree type.

Metric 1 leaves 16 leaves 64 leaves 128 leaves 512 leaves 1024 leaves 2048 leaves 4096 leaves 32 leaves
batch_insert_into_append_only_tree_16_depth_ms 10.4 16.8 N/A N/A N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_16_depth_hash_count 16.7 31.8 N/A N/A N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_16_depth_hash_ms 0.606 0.516 N/A N/A N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_32_depth_ms N/A N/A 48.9 (+1%) 76.4 247 474 931 1,848 N/A
batch_insert_into_append_only_tree_32_depth_hash_count N/A N/A 95.9 159 543 1,055 2,079 4,127 N/A
batch_insert_into_append_only_tree_32_depth_hash_ms N/A N/A 0.500 (+1%) 0.471 0.448 0.442 0.441 0.441 N/A
batch_insert_into_indexed_tree_20_depth_ms N/A N/A 58.3 (+1%) 112 (-1%) 355 (+1%) 698 1,384 2,763 N/A
batch_insert_into_indexed_tree_20_depth_hash_count N/A N/A 106 208 692 1,363 2,707 5,395 N/A
batch_insert_into_indexed_tree_20_depth_hash_ms N/A N/A 0.505 (+1%) 0.503 0.482 (+1%) 0.479 0.479 0.480 N/A
batch_insert_into_indexed_tree_40_depth_ms N/A N/A N/A N/A N/A N/A N/A N/A 64.3 (+3%)
batch_insert_into_indexed_tree_40_depth_hash_count N/A N/A N/A N/A N/A N/A N/A N/A 107
batch_insert_into_indexed_tree_40_depth_hash_ms N/A N/A N/A N/A N/A N/A N/A N/A 0.569 (+3%)

Miscellaneous

Transaction sizes based on how many contract classes are registered in the tx.

Metric 0 registered classes 1 registered classes
tx_size_in_bytes 84,050 665,267

Transaction size based on fee payment method

| Metric | |
| - | |

@dbanks12 dbanks12 marked this pull request as draft May 23, 2024 17:14
Copy link
Contributor Author

@dbanks12 dbanks12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do I need to add an entry to build-ci in top-level Earthfile? This image isn't used by any CI jobs. It is only for the end user.

@dbanks12 dbanks12 marked this pull request as ready for review May 23, 2024 19:18
@dbanks12 dbanks12 requested review from charlielye and ludamad May 23, 2024 19:18
@dbanks12 dbanks12 requested review from charlielye and spypsy May 24, 2024 19:49
@dbanks12 dbanks12 force-pushed the db/sandbox-auto-transpile branch from 02ff074 to 5622033 Compare May 28, 2024 16:23
@dbanks12 dbanks12 force-pushed the db/nargo-show-artifact-paths branch from fc8814b to 3eb498f Compare May 28, 2024 16:24
@dbanks12 dbanks12 force-pushed the db/sandbox-auto-transpile branch from 5622033 to e7513c0 Compare May 28, 2024 16:26
Copy link
Collaborator

@ludamad ludamad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM other than earthfile not currently being used in ci.yml or otherwise, seems likely to coderot

@dbanks12
Copy link
Contributor Author

LGTM other than earthfile not currently being used in ci.yml or otherwise, seems likely to coderot

Fair enough regarding code rot! I know that we're gearing up for a shift to Earthly GA releases, so I wanted to make sure I did the legwork there too.

Base automatically changed from db/nargo-show-artifact-paths to master May 29, 2024 14:58
@dbanks12 dbanks12 enabled auto-merge (squash) May 29, 2024 15:10
@dbanks12 dbanks12 dismissed charlielye’s stale review May 29, 2024 17:29

Addressed all of charlie's concerns and got approval from @ludamad

@dbanks12 dbanks12 merged commit 9639f34 into master May 29, 2024
@dbanks12 dbanks12 deleted the db/sandbox-auto-transpile branch May 29, 2024 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants